<template>
  <div>
    
    <Card>
      <div class="textRight marginB10">
        <span class="marginR10">已选
          <span class="cBlue">{{selectMore.length}}</span>
          条数据
        </span>
        <Button type="primary" size="small" shape="circle" @click="huLAll" :disabled="!$app.judgeData(selectMore)">
          <Icon type="md-trash" size="16" />
          忽略
        </Button>
      </div>
      <Table
        :data="tableData"
        :columns="columns"
        stripe
        border
        class="marginB10"
        :loading="loading"
        @on-selection-change="onSelect"
        :height="$app.winHeight-220"
      ></Table>
      <Page
        :total="total"
        show-sizer
        show-total
        show-elevator
        size="small"
        :page-size="pageSize"
        :page-size-opts="$app.pageAll.pageSizeOpts"
        :current="page"
        @on-change="loadMore"
        @on-page-size-change="changePageSize"
      ></Page>
    </Card>
    <PABox ref="PABox" />
    <Temp ref="Temp" :type="8" />
  </div>
</template>

<script>
import PABox from "@$@/_service/PABox";
import Temp from "@$@/_service/temp";
import ListWarnInfo_NJ from "@$@/js/warnXT/ListWarnInfo_NJ";
export default {
  name: "ListWarnInfo9",
  components: { PABox,Temp },
  data() {
    return {
      loading: true, //加载时显示转转
      total: 0, //总页数
      page: 1, //当前页码
      pageSize: $app.pageAll.pageSize, //分页条数，最低15条
      selectMore:[],

      //列表
      tableData: [],
      columns:[]
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    // 续费
    woRb(num){
      this.$refs['Temp'].show119Box(num,true);
    },
    //年费记录
    xwtwPP(patent_no,patent_name){
      $ajax.z_pMpF(patent_no,resData=>{
        this.$refs['PABox'].showBox=true;
        this.$refs['PABox'].titleT=patent_name;

        this.$refs['PABox'].data1=resData.not_pay;//未缴费信息
        this.$refs['PABox'].data2=resData.paid;//已缴费信息

        //return 退费信息
        this.$refs['PABox'].data3=resData.return;
        //late 滞纳金
        this.$refs['PABox'].data4=resData.late;
      });
    },
    //获取数据
    getData() {
      let { page, pageSize } = this;
      // 清空原本的数据
      this.loading = true;
      this.columns = [];
      this.tableData = [];
      this.selectMore=[];//初始化的时候

      $ajax.z_getXepr({ page, pageSize }, resData => {
        this.loading = false;
        this.columns=ListWarnInfo_NJ.list(this);
        this.tableData = resData.list;
        this.total = resData.total;
      });
    },
    // 加载更多
    loadMore(page) {
      this.page = page;
      this.$nextTick(() => {
        this.getData();
      });
    },
    // 数据返回条
    changePageSize(pageSize) {
      this.pageSize = pageSize;
      this.page = 1;
      this.$nextTick(() => {
        this.getData();
      });
    },
    
    // 单个忽略
    huLA(obj){
      this.huXz({id:JSON.stringify([obj.id])})
    },

    // 触发忽略
    huXz(obj){
      $ajax.schedule_ignorePatentYearFee(obj, res => {
        $app.toast(res.msg, true);
        this.page = 1;
        this.$nextTick(() => {
          this.getData();
        });
      });
    },
    

    // 集体忽略
    huLAll() {
      let { selectMore } = this;
      if ($app.judgeData(selectMore)) {
        $app.confirm("您确定忽略所选项目?", "温馨提示", {
          yesFun: () => {
            this.huXz({ id: JSON.stringify(selectMore) });
          }
        });
      } else {
        this.$Message.error({content: "请选择需忽略的项目"});
      }
    },
    // 多选模式触发
    onSelect(list, row) {
      let selectMore = [];
      list.forEach((val, i) => {
        selectMore.push(val.id);
      });
      this.selectMore = selectMore;
    }
  }
};
</script>

